package cn.xzzz2020.XJynWeb.mvc.render.impl;

import cn.xzzz2020.XJynWeb.mvc.RequestProcessorChain;
import cn.xzzz2020.XJynWeb.mvc.render.ResultRender;

import javax.servlet.http.HttpServletResponse;

/**
 * 渲染找不到资源结果的渲染器
 * @author xzzz2020
 * @version 1.0
 * @date 2020/9/4 16:32
 */
public class ResourceNotFoundResultRender implements ResultRender {

    private String httpMethod;
    private String httpPath;

    public ResourceNotFoundResultRender(String httpMethod, String httpPath) {
        this.httpMethod = httpMethod;
        this.httpPath = httpPath;
    }

    @Override
    public void render(RequestProcessorChain requestProcessorChain) throws Exception {
        requestProcessorChain.getResponse().sendError(HttpServletResponse.SC_NOT_FOUND,
                "获取不到对应的请求资源：请求路径[" + httpPath + "]" + "请求方法[" + httpMethod + "]");
    }
}
